<template>
  <div class="main">
    <div class="header">
      <span class="icon"></span>
      <span class="title">洪山监狱笔录软件<span style="color: red;font-size: 20px;"><span v-if="systemProp.department">（{{ systemProp.department }}，欢迎使用笔录软件！）</span><span v-else>(初次使用，请到系统设置的系统属性中设置单位名称)</span></span></span>
      <span style="margin-left: auto;">
        <el-dropdown style="float: right;cursor: pointer;line-height: 50px;color: #fff;">
        <span class="el-dropdown-link">
          {{ username }}
          <el-icon class="el-icon--right">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item @click="logout">退出</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
      </span>
    </div>
    <el-container>
      <el-aside width="200px">
        <Menu></Menu>
      </el-aside>
      <el-container style="height: 100%;">
        <el-header>
            <Top></Top>
        </el-header>
        <el-main>
            <RightPanel></RightPanel>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script lang="ts" setup>
import { ref, reactive ,onMounted} from 'vue'
import Menu from './components/menu.vue';
import Top from './components/top.vue';
import RightPanel from './components/RightPanel.vue';
import { useRouter } from 'vue-router'
const router = useRouter()
const username = ref('')
const systemProp=reactive({})
onMounted(() => {
  username.value = sessionStorage.getItem('username')
  let system_prop = localStorage.getItem('system_prop')
  if(system_prop){
    const data = JSON.parse(system_prop)
    Object.assign(systemProp, data)
  }
})
function logout() {
  router.push({ path: '/' })
  window.operation.restore()
}

</script>

<style lang="scss" scoped>
.header{
    background-color: #409eff;
    color: white;
    font-size: 30px;
    padding: 20px;
    display: flex;
    .icon{
        display: inline-block;
        width: 50px;
        height: 50px;
        background-image: url("../assets/jh.jpeg");
        background-size: cover;
    }
    .title{
        height: 50px;
        line-height: 50px;
        display: inline-block;
    }
}
.main{
    width: 100%;
    height: 100%;
}
.el-container {
    height: calc(100% - 90px);
}
</style>
